home *** CD-ROM | disk | FTP | other *** search
- Path: dispatch.news.demon.net!demon!summat.demon.co.uk
- From: mike@summat.demon.co.uk (Mike Dodd)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Randomness
- Date: Sun, 21 Apr 1996 14:42:56 GMT
- Message-ID: <1160.6685T814T1100@summat.demon.co.uk>
- References: <451.6681T677T994@summat.demon.co.uk> <4lavaq$i30@louhi.kempele.fi>
- NNTP-Posting-Host: summat.demon.co.uk
- X-NNTP-Posting-Host: summat.demon.co.uk
- X-Newsreader: THOR 2.22 (Amiga;TCP/IP)
-
-
- Mike staggered back from the pub and slurred to Jarkko Vatjus-Anttila:
-
- JV> rndnumber
- JV> move.w seed,d1
- JV> mulu.w #31421,d1
- JV> add.w #6927,d1
- JV> mulu.w d1,d0
- JV> move.w d1,seed ; init new seed to make sure that numbers remain random
- JV> clr.w d0
- JV> swap d0 ; upper 16 bits are the most random.
- JV> rts
-
- JV>: but this produces a rather poor sequence of values...Soooerh, any bette
- JV>: suggestions ?
-
- JV> What do you think of mine?
-
- Thanks for your help, also, thanks to everyone else who responded to my original
- plea. I'm now having a look at a routine provided by Andrew Bennet which seems
- suitable for my needs.
-
- As for your own routine - I've not actually tried it - I'm sure it provides good
- results but I feel that it might be a little less efficient for the purposes I'm
- trying to use it for, compared with the routine I'm now using, with respect to
- execution speed and register usage (it would be called many times within each
- frame of a game I'm writing, and so needs to be optimised for speed as much as
- possible).
-
- Once again, thanks for your help.
-
- --
- Mike (mike@summat.demon.co.uk | fidonet@2:2500/73.10)
-
-
-